from selenium.webdriver.common.by import By

byid = By.ID
byname = By.NAME
bycname = By.CLASS_NAME
bytname = By.TAG_NAME
bylink = By.LINK_TEXT
bycss = By.CSS_SELECTOR
byxpath = By.XPATH
byparriallike = By.PARTIAL_LINK_TEXT

url = "http://10.59.9.8:7007/boss/"
# 登录界面元素配置信息
class LoginPageElements:
    """登录页面元素定位配置（优化后）"""
    # 账号
    login_username = byxpath, '//*[@id="form1"]/div[2]/ul[1]/li[2]/input'
    # 页面信息（会员登录）
    #密码
    login_pwd = byxpath,'//*[@id="form1"]/div[2]/ul[2]/li[2]/input'
    # login_dy_text = bycname, 'reg-new'
    # login_username = byname, 'username'
    # login_pwd = byname, 'password'
    login_btn = byxpath, '/html/body/div[1]/div[2]/div[1]/form/div[3]/input'
    login_dy_text = byxpath,'/html/body/div[1]/div[2]/div[2]/div[1]/h2'  #断言  系统菜单


login_pe = LoginPageElements()

# 首页界面元素配置信息
class HomePageElements:
    # 权限管理_大标签
    rights_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[1]/h2'
    # 菜单管理_小标签
    menu_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/ul/li[1]/div/a'
    # 权限管理_小标签
    rights_management_min = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/ul/li[2]/div/a'
    # 角色管理_小标签
    roles_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/ul/li[3]/div/a'
    # 操作员管理_小标签
    operator_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/ul/li[4]/div/a'
    # 账户管理_大标签
    account_management = byxpath, '/html/body/div[1]/div[2]/div[2]/div[2]/div[3]/h2'
    # 账户历史信息_小标签
    account_history_information= byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[4]/ul/li[2]/div/a'
    # 用户管理_大标签
    user_management=byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[5]/h2'
    # 用户信息_小标签
    user_information=byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[6]/ul/li/div/a'
    # 支付管理_大标签
    Payment_Management=byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[7]/h2'
    # 支付产品信息_小标签
    payment_product_information = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[8]/ul/li[1]/div/a'
    # 用户支付配置_小标签
    user_payment_configuration = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[8]/ul/li[2]/div/a'
    # 交易管理_大标签
    transaction_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[9]/h2'
    # 支付订单管理_小标签
    payment_order_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[10]/ul/li[2]/div/a'
    # 支付记录管理_小标签
    payment_record_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[10]/ul/li[3]/div/a'
    # 结算管理_大标签
    settlement_management=byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[11]/h2'
    # 结算记录管理_小标签
    settlement_record_management = byxpath,'/html/body/div[1]/div[2]/div[2]/div[2]/div[12]/ul/li/div/a'
    # 对账管理_大标签
    # 对账差错列表_小标签
    # 对账批次列表_小标签
    # 对账缓冲池列表_小标签
home_pe = HomePageElements()

class RightsPageElements:
    # 断言 菜单管理
    menu_dy_text = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div/div/div[1]/div/ul/li/a/span'
    # 添加按钮
    add_btn = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/ul/li[1]/a/span'
    # 删除按钮
    del_btn = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/ul/li[2]/a/span'
    # 刷新按钮
    refresh_btn = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/ul/li[3]/a/span'
    # 断言 添加菜单
    add_menu_text = byxpath,'/html/body/div[13]/div[1]/div/div/h1'
    # 菜单名称输入框
    menu_name = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[2]/input'
    # 菜单编号输入框
    menu_num = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[3]/input'
    # 保存按钮
    save_btn = byxpath,'/html/body/div[13]/div[2]/div/form/div[2]/ul/li[1]/div/div/button'
    # 取消按钮
    cancel_btn = byxpath,'/html/body/div[13]/div[2]/div/form/div[2]/ul/li[2]/div/div/button'
    # 定位菜单
    menu = byparriallike,'7777'
    # 定位对账管理菜单
    menu2 = byxpath, '/html/body/div[1]/div[3]/div/div[2]/div[2]/div/div/div[2]/div/div[2]/ul/li[9]/div/a'
    # 定位子菜单
    submenu = byparriallike, '77771'
    # 子菜单名称输入框
    submenu_name = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[2]/input'
    # 子菜单编号输入框
    submenu_num = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[3]/input'
    # 子菜单保存按钮
    submenu_save_btn = byxpath,'/html/body/div[13]/div[2]/div/form/div[2]/ul/li[1]/div/div/button'

    # 编辑菜单编号
    edit_submenu_num=byxpath,'//input[@name="number" and contains(@class, "textInput")]'
    # 编辑菜单保存按钮
    edit_submenu_save_btn=byxpath,'//button[text()="保存"]'

rightspage = RightsPageElements()

class RolePageElements:
    # 断言 权限名称
    permission_dy_text = byxpath, '//a[@class="add" and @title="添加权限"]'
    # 修改按钮
    edit_btn = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[6]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[1]'
    # 删除按钮
    del_btn = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[6]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]'
    # 权限名称输入框
    permission_name_input = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[1]/input'
    # 权限标识输入框
    permission_number_input = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[2]/input'
    # 权限描述输入框
    permission_desc_input = byxpath,'/html/body/div[13]/div[2]/div/form/div[1]/p[4]/textarea'
    # 保存权限按钮
    save_permission_btn = byxpath,'/html/body/div[13]/div[2]/div/form/div[2]/ul/li[1]/div/div/button'
    # 断言是否添加成功
    dy_msg = byxpath,'/html/body/div[14]/div[1]/div/div[1]/div'
    # 断言
    dy = byxpath,'/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[2]/div'


rolepage = RolePageElements()